<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>今天星期几？</title>
	</head>
	<body>
		<h2 id="day"></h2>
		<script>
			//从Date 对象返回
			var date=new Date().getDay();
			//获取<h2>元素对象
			var h2=document.getElementById('day');
			var s="今天星期";
			switch(date){
				case 0:
				s+="天";
				break;
				case 1:
				s+="一";
				break;
				case 2:
				s+="二";
				break;
				case 3:
				s+="三";
				break;
				case 4:
				s+="四";
				break;
				case 5:
				s+="五";
				break;
				case 6:
				s+="六";
				break;
			 default:
				break;
			}
			h2.innerHTML=s;
			
		</script>
	</body>
</html>
